Add native AST support for USING JAR/FILE/ARCHIVE in CREATE FUNCTION#7436
Merged
georgesittas merged 2 commits intotobymao:mainfrom Apr 3, 2026
Merged
Add native AST support for USING JAR/FILE/ARCHIVE in CREATE FUNCTION#7436georgesittas merged 2 commits intotobymao:mainfrom
georgesittas merged 2 commits intotobymao:mainfrom
Conversation
Parse Hive/Spark CREATE FUNCTION ... USING JAR/FILE/ARCHIVE statements into proper AST nodes instead of falling back to the Command expression. This adds a UsingProperty node that allows programmatic inspection and modification of the resource type and path in CREATE FUNCTION statements. Fixes tobymao#7435
Collaborator
|
Hey @hashwnath, thanks for the PR. Can you please run |
Resolves formatting per `make style` as requested by maintainer.
georgesittas
approved these changes
Apr 3, 2026
Collaborator
georgesittas
left a comment
There was a problem hiding this comment.
I'll get this in and take it to the finish line, thank you for the contribution!
Comment on lines
+534
to
+537
| def usingproperty_sql(self, expression: exp.UsingProperty) -> str: | ||
| kind = expression.args.get("kind") | ||
| return f"USING {kind} {self.sql(expression, 'this')}" | ||
|
|
Collaborator
There was a problem hiding this comment.
This should be moved to generator.py, otherwise UsingProperty.sql() will crash.
Comment on lines
+241
to
+246
| def _parse_using_property(self) -> exp.Property: | ||
| if self._match_texts(("JAR", "FILE", "ARCHIVE")): | ||
| kind = self._prev.text.upper() | ||
| return exp.UsingProperty(this=self._parse_string(), kind=kind) | ||
|
|
||
| return self._parse_property_assignment(exp.FileFormatProperty) |
Collaborator
There was a problem hiding this comment.
FWIW, I'm not sure if this is complete, as per Hive's docs:
CREATE FUNCTION [db_name.]function_name AS class_name
[USING JAR|FILE|ARCHIVE 'file_uri' [, JAR|FILE|ARCHIVE 'file_uri'] ];
georgesittas
pushed a commit
that referenced
this pull request
Apr 3, 2026
…TE FUNCTION (#7436) * Add native AST support for USING JAR/FILE/ARCHIVE in CREATE FUNCTION Parse Hive/Spark CREATE FUNCTION ... USING JAR/FILE/ARCHIVE statements into proper AST nodes instead of falling back to the Command expression. This adds a UsingProperty node that allows programmatic inspection and modification of the resource type and path in CREATE FUNCTION statements. Fixes #7435 * style: run ruff-format on test_hive.py Resolves formatting per `make style` as requested by maintainer. Signed-off-by: George Sittas <giwrgos.sittas@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
UsingPropertyAST node to representUSING JAR/FILE/ARCHIVEclauses in Hive/SparkCREATE FUNCTIONstatementsCommandexpressionPreviously,
CREATE FUNCTION my_func AS 'com.MyFunc' USING JAR 's3://path'would be parsed as aCommandnode with the entire SQL as a raw string. Now it produces a properCreatenode with aUsingPropertythat can be inspected and modified.Test plan
USING JAR,USING FILE, andUSING ARCHIVEroundtrip parsingCREATE OR REPLACE TEMPORARY FUNCTION ... USING JARFixes #7435